package factory;

import dao.PetDao;
import dao.PetDaoMySQLImpl;
import dao.PetDaoOracleImpl;

/**
 * @Description
 * @Author 李楚鹏
 * @Date 2024/12/11 15:48
 **/

public class PetDaoFactory {
    public static String defaultBeanName="petDaoMySQLImpl";

    public static PetDao getInstance(String beanName){
        PetDao petDao=null;
        switch (beanName){
            case "petDaoMySQLImpl":
                petDao=new PetDaoMySQLImpl();
                break;
            case "petDaoOracleImpl":
                petDao=new PetDaoOracleImpl();
                break;
            default:
                throw new RuntimeException("未找到'"+beanName+"'对应的对象.");
        }
        return petDao;
    }
}
